<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript">
 $(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules: {
			gbprice: {isMoney: true},
			zspointnum:{isMoney: true},
			zsdedunum:{isMoney: true},
			zscouponnum:{isMoney: true},
			sellPrice: {isMoney: true},
			sellerprice: {isMoney: true},
			oppoint: {isMoney: true},
			opdedu: {isMoney: true},
			opcoupon: {isMoney: true},
			muchsellerprice: {isMoney: true},
			mppoint: {isMoney: true},
			mpdedu: {isMoney: true},
			mpcoupon: {isMoney: true},
			price:{isMoney: true},
/* 			stock:{digits: true}, */		
			zdsx:{digits: true},
			countnum:{digits: true},
			yyts:{digits: true},
			jyrs:{digits: true},
			zdrs:{digits: true},	
		},
		messages: {
			name: {required: "请输入商品标题"},
			gbprice: {required: "请输入团购销售价",isMoney: "请填写正确的金额，最多保留两位小数位"},
			zspointnum: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			zsdedunum: {required: "请输入抵扣券",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			zscouponnum: {required: "请输入优惠券",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			sellPrice: {required: "请输入商品市场售价",isMoney: "请填写正确的金额，最多保留两位小数位"},
			sellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			
			oppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			muchsellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			mppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			price: {required: "请输入价值",isMoney: "请填写正确的价值，最多保留两位小数位"},
			
		/* 	stock: {required: "请输入商品库存",digits: "请填写正确的数量"}, */
			countnum: {required: "请输入商品库存",digits: "请填写正确的数量"},
			zdsx: {required: "请输入正确的指定上限",digits: "请填写正确的数量"},
			yyts: {required: "请输入商品库存",digits: "请填写正确的数量"},
			jyrs: {required: "请输入正确的建议",digits: "请填写正确的数量"},
			zdrs: {required: "请输入正确的指定人数",digits: "请填写正确的数量"},
			categoryonid: {required: "请选择一级分类"},
			categorytwid: {required: "请选择二级分类"},
			categorythid: {required: "请选择三级分类"},
			categoryfoid: {required: "请选择四级分类"}
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case 2:
						Kit.alert("请选择商品分类");return;
					case 3:
						Kit.alert("请添加分公司");return;
					case 4:
						Kit.alert("请添加市场价");return;
					case 5:
						Kit.alert("请添加库存");return;
					case 9:
						Kit.alert("请添加客服二维码");return;
					case 7:
						Kit.alert("Logo图片不能为空！");return;
					case 8:
						Kit.alert("请添加价格");return;
					case 10:
						Kit.alert("请填写宝贝内容");return;
					case 11:
						Kit.alert("请填写规格内容");return;
					case 12:
						Kit.alert("请点击添加轮播图片，进行图片的添加！");return;
					case 13:
						Kit.alert("请点击添加详情图片，进行图片的添加！");return;
					case 14:
						Kit.alert("添加规格错误");return;
					case 15:
						Kit.alert("支付方式升级为多选，请联系程序员");return;
					case 16:
						Kit.alert("已选中赠送优惠，请选择赠送的积分值选项");return;
					case 17:
						Kit.alert("已选中赠送优惠类别，请填写积分值");return;
					case 18:
						Kit.alert("已选中支付金额，请填写金额");return;
					case 19:
						Kit.alert("已选中支付积分值，请填写积分值");return;
					case 20:
						Kit.alert("请至少选择一种支付方式");return;
					/* case -1:
						Kit.alert("网络繁忙...，请重试");return;  */
					case  -1:
						dataPaginator.loadPage(1);
						addDialog.close();
						return;
					}
				}
			});
		}
	});
}); 

$(document).ready(function(){
    $("#addTable").click(function(){
       var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" name=\"check\" checked=\"checked\" />"+
              "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"name\" maxlength=\"10\" style=\"width:195px;height:30px;\"/>"+
              "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"number\" onkeyup=\"(this.vads=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)\" onblur=\"this.vads();\" style=\"width:195px;height:30px;\" />"+
              "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"price\"  onkeyup=\"(this.vads=function(){this.value=this.value.replace(/[^0-9]+/-.,'');}).call(this)\" onblur=\"this.vads();\" style=\"width:195px;height:30px;\" />"+
              "</td></tr>";
              $("#tableb").append(tr);
    });
    $("#deleteTable").click(function(){
        var check = document.getElementsByName("check");
        for(var i=0;i<check.length;i++){
            if(check[i].checked){
                 document.getElementById('tableb').deleteRow(i);
                 i--;
            }
        }
    });
     $("#deleteTablea").click(function(){
        var check = document.getElementsByName("checks");
        var ths=check.length;
        var numb=parseFloat($("#chooseNum").html());
        for(var i=0;i<check.length;i++){
            if(check[i].checked){
                 document.getElementById('tablea').deleteRow(i);
                 i--;
                 numb--;
            }
        }
        $("#chooseNum").text((numb));
        $("#storeid").val((numb));
    })

})
  var addStoreDialog;
function addStore(){
	addStoreDialog = Kit.dialog("添加分公司","${BASE_PATH}/bus/goods/base/chooseAllStore",{closable:true,size:'size-wide'}).open();
}  
function onStoreChoosed(id,title,address,tel){
	var trs= $("#tablea tr");
	var array=new Array();
	var numb=parseFloat($("#chooseNum").html());
	for (var i = 0; i < trs.length; i++) {
		var tds = $(trs[i]).children();
		var sid = $(tds[0]).find("#ids").val();
		array.push(sid);
	}
	if(contains(array,id)){
		alert("该分公司已添加");
	}else{
	 var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"checks\" value='"+id+"'/>"+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+title+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+address+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+tel+
     "</td></tr>";
     $("#tablea").append(tr);
     $("#chooseNum").text((numb+1));
     $("#storeid").val((numb+1));
	}
}
function contains(arr, obj) {  
    var i = arr.length;  
    while (i--) {  
        if (arr[i] === obj) {  
            return true;  
        }  
    }  
    return false;  
} 

$("#tbtd").hide();
$("#tbts").hide(); 
$("#bufen").hide();
$("#zdsx").hide();
$("#yyts").hide();
$("#jyrs").hide();
$("#xzrs").hide();
$("#gbattr").hide();
$("#zsnumattr").hide();
$("#gbfpperson").hide();
$("#zspointnum").hide();
$("#zsdedunum").hide();
$("#zscouponnum").hide();
$("#payonlyactivity").hide();
$("#oppoint").hide();
$("#opdedu").hide();
$("#opcoupon").hide();
$("#paymoneyandactivity").hide();
$("#muchsellerprice").hide();
$("#mppoint").hide();
$("#mpdedu").hide();
$("#mpcoupon").hide();

/* $(".mpay").click(function(){
	var v = $('input[name="multipay"]').filter(':checked').val(); 
	if(v==1){
		$("#sellerprice").show();
		$("#payonlyactivity").hide();
		$("#oppoint").val("");
		$("#opdedu").val("");
		$("#opcoupon").val("");
		$("#paymoneyandactivity").hide();
		$("#muchsellerprice").val("");
		$("#mppoint").val("");
		$("#mpdedu").val("");
		$("#mpcoupon").val("");
	}else 
	if(v==2){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#paymoneyandactivity").hide();
		$("#mppoint").val("");
		$("#mpdedu").val("");
		$("#mpcoupon").val("");
		$("#payonlyactivity").show();
		$("#payonlyactivity").click(function(){
			 var vs = $('input[name="onlypaypoint"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#oppoint").show();
			 }else{
				 $("#oppoint").hide();
				 $("#oppoint").val("");
			 }
			 var vs = $('input[name="onlypaydedu"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opdedu").show();
			 }else{
				 $("#opdedu").hide();
				 $("#opdedu").val("");
			 }
			 var vs = $('input[name="onlypaycoupon"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opcoupon").show();
			 }else{
				 $("#opcoupon").hide();
				 $("#opcoupon").val("");
			 }		 
		});
	}else if(v==3){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#payonlyactivity").hide();
		$("#oppoint").val("");
		$("#opdedu").val("");
		$("#opcoupon").val("");
		$("#paymoneyandactivity").show();
		$("#paymoneyandactivity").click(function(){
			var vsp= $('input[name="mpayprice"]').filter(':checked').val(); 
			if(vsp==1){
				$("#muchsellerprice").show();
			}else{
				$("#muchsellerprice").hide();
				$("#muchsellerprice").val("");
			}
			var vsp= $('input[name="mpaypoint"]').filter(':checked').val(); 
			if(vsp==1){
				$("#mppoint").show();
			}else{
				$("#mppoint").hide();
				$("#mppoint").val("");
			}
			var vsd = $('input[name="mpaydedu"]').filter(':checked').val(); 
			if(vsd==1){
				$("#mpdedu").show();
			}else{
				$("#mpdedu").hide();
				$("#mpdedu").val("");
			}
			var vsc = $('input[name="mpaycoupon"]').filter(':checked').val(); 
			if(vsc ==1){
				$("#mpcoupon").show();
			}else{
				$("#mpcoupon").hide();
				$("#mpcoupon").val("");
			}		 
		});
	}
}); */
/* $(".oactivity").click(function(){
	var v = $('input[name="multipay"]').filter(':checked').val(); 
	if(v==1){
		$("#payonlyactivity").show();
		$("#payonlyactivity").click(function(){
			 var vs = $('input[name="onlypaypoint"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#oppoint").show();
			 }else{
				 $("#oppoint").hide();
				 $("#oppoint").val("");
			 }
			 var vs = $('input[name="onlypaydedu"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opdedu").show();
			 }else{
				 $("#opdedu").hide();
				 $("#opdedu").val("");
			 }
			 var vs = $('input[name="onlypaycoupon"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opcoupon").show();
			 }else{
				 $("#opcoupon").hide();
				 $("#opcoupon").val("");
			 }		 
		});
	}else {
		$("#payonlyactivity").hide();
		$("#onlypaypoint").val("");
		$("#onlypaydedu").val("");
		$("#onlypaycoupon").val("");
	}
});
$(".mactivity").click(function(){
	var v = $('input[name="multipay"]').filter(':checked').val(); 
	if(v==1){
		$("#paymoneyandactivity").show();
		$("#paymoneyandactivity").click(function(){
			var vsp= $('input[name="mpayprice"]').filter(':checked').val(); 
			if(vsp==1){
				$("#muchsellerprice").show();
			}else{
				$("#muchsellerprice").hide();
				$("#muchsellerprice").val("");
			}
			var vsp= $('input[name="mpaypoint"]').filter(':checked').val(); 
			if(vsp==1){
				$("#mppoint").show();
			}else{
				$("#mppoint").hide();
				$("#mppoint").val("");
			}
			var vsd = $('input[name="mpaydedu"]').filter(':checked').val(); 
			if(vsd==1){
				$("#mpdedu").show();
			}else{
				$("#mpdedu").hide();
				$("#mpdedu").val("");
			}
			var vsc = $('input[name="mpaycoupon"]').filter(':checked').val(); 
			if(vsc ==1){
				$("#mpcoupon").show();
			}else{
				$("#mpcoupon").hide();
				$("#mpcoupon").val("");
			}		 
		});
	}else {
		$("#paymoneyandactivity").hide();
		$("#mpayprice").val("");
		$("#mpaypoint").val("");
		$("#mpaydedu").val("");
		$("#mpaycoupon").val("");
	}
}); */
/* 是否团购 */
 $(".group").click(function(){
	var v = $('input[name="groupbuying"]').filter(':checked').val(); 
	if(v==1){
		$("#gbattr").hide();
	}else if(v==2){
		$("#gbattr").show();
		/* 团购方法 */	 
		$(".gmethod").click(function(){
			var vs = $('input[name="gbmethod"]').filter(':checked').val(); 
			if(vs==1){
				$("#gbfpperson").hide();
			}else if(vs==2){
				$("#gbfpperson").show();
			}else if(vs==3){
				$("#gbfpperson").show();
			}
		});
	}
}); 
/* 是否赠送优惠 */	 
$(".zactivity").click(function(){
	var v = $('input[name="zsactivity"]').filter(':checked').val(); 
	if(v==1){
		$("#zsnumattr").hide();
	}else if(v==2){
		$("#zsnumattr").show();
		var vz = $('input[name="zsactivity"]').filter(':checked').val(); 
		if(vz==1){
			$("#zsnumattr").hide();
		}else if(vz==2){
			$("#zsnumattr").show();
			$("#zsnumattr").click(function(){
				 var vsp = $('input[name="zspoint"]').filter(':checked').val(); 
				 if(vsp==1){
					 $("#zspointnum").show();
				 }else{
					 $("#zspointnum").hide();
					 $("#zspointnum").val("");
				 }
				 var vsd = $('input[name="zsdedu"]').filter(':checked').val(); 
				 if(vsd==1){
					 $("#zsdedunum").show();
				 }else{
					 $("#zsdedunum").hide();
					 $("#zsdedunum").val("");
				 }
				 var vsc = $('input[name="zscoupon"]').filter(':checked').val(); 
				 if(vsc==1){
					 $("#zscouponnum").show();
				 }else{
					 $("#zscouponnum").hide();
					 $("#zscouponnum").val("");
				 }		 
			});
		}	
	}
});
 $(".tuan").click(function(){
		var v = $('input[name="goods"]').filter(':checked').val(); 
		if(v==1){
			$("#tbts").hide();
		}else if(v==2){
			$("#tbts").show();
			 $("#tbts").click(function(){
				 var vs = $('input[name="times"]').filter(':checked').val(); 
				 if(vs==1){
					 $("#tbtd").hide();
				 }else{
					 $("#tbtd").show();
				 }
			 });
		}
	});
 $(".kysj").click(function(){
		var v = $('input[name="keyong"]').filter(':checked').val(); 
		if(v==1){
			$("#bufen").hide();
		}else if(v==2){
			$("#bufen").show();
		}
	});
 $(".gmsx").click(function(){
		var v = $('input[name="goumai"]').filter(':checked').val(); 
		if(v==1){
			$("#zdsx").hide();
		}else if(v==2){
			$("#zdsx").show();
		}
	});
 $(".xyyy").click(function(){
		var v = $('input[name="yuyue"]').filter(':checked').val(); 
		if(v==1){
			$("#yyts").hide();
		}else if(v==2){
			$("#yyts").show();
		}
	});
 $(".syrs").click(function(){
		var v = $('input[name="shiyongrenshu"]').filter(':checked').val(); 
		if(v==0){
			$("#jyrs").hide();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else if(v==1){
			$("#jyrs").hide();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else if(v==2){
			$("#jyrs").show();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else{
			$("#jyrs").hide();
			$("#xzrs").show();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}
	});
/*可选服务 */
 /* $("#kexuan").click(function(){
	$("#keke").show();
 });
 $("#keke").hide(); */
 var imagesDialogs;
 
 function toUploadImages(){
	 
 	imagesDialogs = Kit.dialog("轮播图片","${BASE_PATH}/bus/goods/base/imageIndex/${LunBoNum}",{closable:true,size:"size-wide"}).open();
 	
 }
 var imagesXiang;
 //var InXiang=$("#Intditl").val();
 function toXiang(){
	 //var InXiang=$("#Intditl").val();
	 //InXiang=parseInt(InXiang)+1;
 	imagesXiang = Kit.dialog("详情图片","${BASE_PATH}/bus/goods/base/imageDetailIndex/${LunBoNum}",{closable:true,size:"size-wide"}).open();
	//alert(InXiang)
 }
 


//DATE PICKER处理时间
 $('.datetimepicker').datetimepicker({
		  format:"yyyy-mm-dd",
		   startView:2,
			minView:2,
            language:  'zh-CN',
            weekStart: 1,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 1,
          showMeridian: 1,
           pickerPosition:'top-right'
      }).on('hide', function(event) {
           event.preventDefault();
         event.stopPropagation();
   });
  $("#sBeginDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	}).on("click",function(){
	    $("#sBeginDate").datetimepicker("setEndDate",$("#sEndDate").val());
	});

	$("#sEndDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    autoclose:true,
		}).on("click",function(){
			var d=$("#sBeginDate").val();
			var d1=new Date(d); 
			d1.setFullYear(d1.getFullYear()+1); 
			d1.setDate(d1.getDate()-1); 
			 $("#sEndDate").datetimepicker("setEndDate",d1);
			$("#sEndDate").datetimepicker("setStartDate",$("#sBeginDate").val());
		});
		
	 $(document).on("click","#sEndDate",function(){
	    	$('#sEndDate').datetimepicker('show');
	    });
   
   $(document).on("click","#sBeginDate",function(){
   	$('#sBeginDate').datetimepicker('show');
   }); 
   
   $("#beginDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	}).on("click",function(){
	    $("#beginDate").datetimepicker("setEndDate",$("#endDate").val());
	});

	$("#endDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    autoclose:true,
		}).on("click",function(){
			var d=$("#beginDate").val();
			var d1=new Date(d); 
			d1.setFullYear(d1.getFullYear()+10); 
			d1.setDate(d1.getDate()-1); 
			$("#endDate").datetimepicker("setEndDate",d1);
			$("#endDate").datetimepicker("setStartDate",$("#beginDate").val());
		});
		
	 $(document).on("click","#endDate",function(){
	    	$('#endDate').datetimepicker('show');
	    });
  
  $(document).on("click","#beginDate",function(){
  	$('#beginDate').datetimepicker('show');
  });

	/*  $("#gbbegintime,#gbendtime").datetimepicker({
	        language: 'zh-CN',  //用自己设置的时间文字
	        //weekStart: 1,  //一周从那天开始，默认为0，从周日开始，可以设为1从周一开始
	        // startDate:"2018-5-20", //开始时间，可以写字符串，也可以直接写日期格式new Date(),在这之前的日期不能选择
	        //endDate:"2018-6-20",
	        //daysOfWeekDisabled: [0,4,6],  //一周的周几不能选
	        todayBtn: 1,  //是否显示今天按钮，0为不显示
	        autoclose: 1, //选完时间后是否自动关闭
	        todayHighlight: 1,  //高亮显示当天日期
	        startView: 2, //0从小时视图开始，选分;1	从天视图开始，选小时;2从月视图开始，选天;3从年视图开始，选月;4从十年视图开始，选年
	        minView: 0,//最精确时间，默认0；0从小时视图开始，选分；1从天视图开始，选小时；2从月视图开始，选天；3从年视图开始，选月；4从十年视图开始，选年
	        //maxView:4,  //默认值：4, ‘decade’
	        //keyboardNavigation:true,  //是否可以用键盘方向键选日期，默认true
	        forceParse: 0, //强制解析,你输入的可能不正规，但是它胡强制尽量解析成你规定的格式（format）
	        format: 'yyyy-mm-dd hh:ii:ss',// 格式,注意ii才是分，mm或MM都是月
	        minuteStep:10, //选择分钟时的跨度，默认为5分钟
	        //pickerPosition:"top-right",  // ‘bottom-left’，’top-right’，’top-left’’bottom-right’
	        showMeridian:0, //在日期和小时选择界面，出现上下午的选项,默认false
	       // showSecond: false,
	       // showMillisec: true,
	        //timeFormat: 'hh:mm:ss:l',
	        //bootcssVer: 3,
	    });
 */

  /* 添加规格 */
  /*function addSpec(){
		var trs= $("#tablespec tr");
		var array=new Array();
		var numb=parseFloat($("#chooseSpecNum").html());
		for (var i = 0; i < trs.length; i++) {
			var tds = $(trs[i]).children();
			var sid = $(tds[1]).find("#KspecName").val();
			console.log("sid===sid==>"+sid);
			array.push(sid);
		}
		var id = array.length +1;
		console.log("id===id==>"+id);
		var specName = $("#specName").val(); //商品规格名称
		var specNum = $("#specNum").val();  //此规格商品的数量
		var marketPrice = $("#marketPrice").val();  //分公司分公司价
		var stock = $("#stock").val(); //库存数量

		var multipay = $('input[name="multipay"]').filter(':checked').val();//多支付类型1.单货币2.单优惠3.组合
		var sellerprice = $("#sellerprice").val(); //单独货币支付价格
		var oppoint = $("#oppoint").val(); //单独优惠支付积分值值
		var opdedu = $("#opdedu").val(); //单独优惠支付抵扣券值		
		var opcoupon = $("#opcoupon").val(); //单独优惠支付积教育分值
		var muchsellerprice = $("#muchsellerprice").val(); //组合支付货币支付价格
		var mppoint = $("#mppoint").val(); //组合支付积分值值
		var mpdedu = $("#mpdedu").val(); //组合支付抵扣券值		
		var mpcoupon = $("#mpcoupon").val(); //组合支付优惠券值
		
		
		var optotal = "无";//全部的单优惠方式
		var opoint = "";
		var odedu = "";
		var ocoupon = "";
		var mptotal = "无";//全部的组合方式
		var mprice = "";
		var mpoint = "";
		var mdedu = "";
		var mcoupon = "";
		//判断不为空
		if (specName==""){
			Kit.alert("商品规格不能为空！");
			return;
		}else if(specNum==""){
			Kit.alert("规格商品的数量不能为空！");
			return;
		}else if(marketPrice==""){
			Kit.alert("分公司分公司价不能为空！");
			return;
		}else if(stock==""){
			Kit.alert("库存数量不能为空！");
			return;
		}else if(!sellerprice){
			Kit.alert("支付方式货币不能为空！");
			return;
		}
		//多种支付方式 
		if(!multipay){
			Kit.alert("至少选择一种支付方式");
			return;
		} else {
			//判断是否是单货币支付方式
			if(multipay == 1){
				if(!sellerprice || sellerprice==0){
					Kit.alert("单货币支付方式——价格不能为空或者0！");
					return;
				}else{
					//单货币赋值
					sellerprice = sellerprice;
				}
			}else{
				sellerprice = "无";
			}
			//判断是否是单优惠支付方式
			if(multipay == 2){
				if(!onlypaypoint && !onlypaydedu && !onlypaycoupon){
					Kit.alert("您已选择优惠支付，请选择优惠方式！");
					return;
				}else{
					//判断是否是单优惠支付积分方式
					if(onlypaypoint == 1){
						if(!oppoint || oppoint==0){
							Kit.alert("优惠支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							opoint = "积分:" + oppoint + ";";
						}
					}
					//判断是否是单优惠支付折扣方式
					if(onlypaydedu == 1){
						if(!opdedu || opdedu==0){
							Kit.alert("优惠支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							odedu = "折扣:" + opdedu + ";";
						}
					}
					//判断是否是单优惠支付优惠券方式
					if(onlypaycoupon == 1){
						if(!opcoupon || opcoupon==0){
							Kit.alert("优惠支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							ocoupon = "优惠券:" + opcoupon;
						}
					}
				optotal = opoint + odedu  + ocoupon;//拼接字符串
				}
			}
			//判断是否为组合支付方式
			if(multipay == 3){
				if(!mpayprice && !mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选择组合付款方式！");
					return; 
				}else if(!mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选至少选择一种优惠方式！");
					return; 
				}else{
					//判断组合支付方式货币是否为空
					if(mpayprice == 1){
						if(!muchsellerprice || muchsellerprice == 0){
							Kit.alert("组合支付方式——货币不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mprice = "货币:" + muchsellerprice + "/";
						}
					}else{
						Kit.alert("组合支付方式——必须包含货币支付");
						return;
					}
					//判断是否是组合支付积分方式
					if(mpaypoint == 1){
						if(!mppoint || mppoint == 0){
							Kit.alert("组合支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mpoint = "积分:" + mppoint + ";";
						}
					}
					//判断是否是组合支付折扣方式
					if(mpaydedu == 1){
						if(!mpdedu || mpdedu == 0){
							Kit.alert("组合支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mdedu = "折扣:" + mpdedu + ";";
						}
					}
					//判断是否是组合支付优惠券方式
					if(mpaycoupon == 1){
						if(!mpcoupon || mpcoupon==0){
							Kit.alert("组合支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mcoupon = "优惠券:" + mpcoupon;
						}
					}	
				mptotal = mprice + mpoint + mdedu + mcoupon;//拼接字符串
				}
			} 
		}
		if(contains(array,specName)){
			alert("该规格已经添加！");
		}else{
			var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"specChecks\" value='"+id+"'/>"+
			"</td><td  style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecName\" hidden=\"hidden\" name=\"KspecName\"  value='"+specName+"'/>"+specName+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecNum\" hidden=\"hidden\" name=\"KspecNum\" value='"+specNum+"'/>"+specNum+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KmarketPrice\" hidden=\"hidden\" name=\"KmarketPrice\" value='"+marketPrice+"'/>"+marketPrice+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kstock\" hidden=\"hidden\" name=\"Kstock\" value='"+stock+"'/>"+stock+
			
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmultipay\" hidden=\"hidden\" name=\"Kmultipay\" value='"+multipay+
				"'/><input type=\"text\" id=\"Ksellerprice\" hidden=\"hidden\" name=\"Ksellerprice\" value='"+sellerprice+"'/>"+sellerprice+
			
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Koppoint\" hidden=\"hidden\" name=\"Koppoint\" value='"+oppoint+
				"'/><input type=\"text\" id=\"Kopdedu\" hidden=\"hidden\" name=\"Kopdedu\" value='"+opdedu+
				"'/><input type=\"text\" id=\"Kopcoupon\" hidden=\"hidden\" name=\"Kopcoupon\" value='"+opcoupon+"'/>"+optotal+

			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmuchsellerprice\" hidden=\"hidden\" name=\"Kmuchsellerprice\" value='"+muchsellerprice+
				"'/><input type=\"text\" id=\"Kmppoint\" hidden=\"hidden\" name=\"Kmppoint\" value='"+mppoint+
				"'/><input type=\"text\" id=\"Kmpdedu\" hidden=\"hidden\" name=\"Kmpdedu\" value='"+mpdedu+
				"'/><input type=\"text\" id=\"Kmpcoupon\" hidden=\"hidden\" name=\"Kmpcoupon\" value='"+mpcoupon+"'/>"+mptotal+ 
			"</td></tr>";
			$("#tablespec").append(tr);
			$("#chooseSpecNum").text((numb+1));
			$("#specid").val((numb+1));
			    
		 	$("#specName").val(""); //商品规格名称
			$("#specNum").val("");  //此规格商品的数量
			$("#marketPrice").val("");  //分公司分公司价
			$("#stock").val(""); //库存数量
			$("input[name='multipay']").prop("checked",false);//多支付方式
			
			$("#sellerprice").val(""); //单独货币支付价格
			$("input[name='onlypaypoint']").prop("checked",false);//单独优惠支付积分类型
			$("#oppoint").val(""); //单独优惠支付积分值值
			$("input[name='onlypaydedu']").prop("checked",false);//单独优惠支付抵扣券类型值
			$("#opdedu").val(""); //单独优惠支付抵扣券值
			$("input[name='onlypaycoupon']").prop("checked",false);//单独优惠支付优惠券类型值
			$("#opcoupon").val(""); //单独优惠支付积教育分值
			
			$("input[name='mpayprice']").prop("checked",false);//组合货币支付类型值
			
			$("#muchsellerprice").val(""); //组合支付货币支付价格
			$("input[name='mpaypoint']").prop("checked",false);//组合支付积分值类型值
			$("#mppoint").val(""); //组合支付积分值值
			$("input[name='mpaydedu']").prop("checked",false);//组合支付抵扣券类型值
			$("#mpdedu").val(""); //组合支付抵扣券值
			$("input[name='mpaycoupon']").prop("checked",false);///组合支付优惠券类型值
			$("#mpcoupon").val(""); //组合支付积教育分值
		}
  }*/
function deltTablElement(){
      var check = document.getElementsByName("specChecks");
      var ths=check.length;
      var numb=parseFloat($("#chooseSpecNum").html());
      for(var i=0;i<check.length;i++){
          if(check[i].checked){
               document.getElementById('tablespec').deleteRow(i);
               i--;
               numb--;
          }
      }
      $("#chooseSpecNum").text((numb));
      $("#specid").val((numb));
  }

  
var kindEditor;
kindEditor = KindEditor.create($("textarea[name='content']"), {
	width:'90px',
	height:'560px',
	resizeType :0,//2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
	langType : 'zh_CN',
    allowUpload : true, 
    allowImageRemote: false,
    uploadJson : '${BASE_PATH}/bus/goods/base/uploadimg',
	items : [
		'preview','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
		'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
		'insertunorderedlist', '|', 'emoticons', 'image', 'link'], 
	afterCreate : function() {this.sync();}, 
    afterBlur:function() {this.sync();} 
 });
//点击事件取下级的值
$("#categoryonid").change(function(){
	categoryonid=$("#categoryonid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categoryonid",
           data: {"categoryonid" : categoryonid},
           dataType: "json",
           traditional: true,
           success: function(data){
			$("#categorytwid").empty();
			$("#categorytwid").append("<option value=''>请选择二级分类</option>");
			for(var i=0; i<data.object.length;i++){
				$("#categorytwid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
$("#categorytwid").change(function(){
	categorytwid=$("#categorytwid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categorytwid",
           data: {"categorytwid" : categorytwid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categorythid").empty(); 
               $("#categorythid").append("<option value=''>请选择三级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categorythid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
$("#categorythid").change(function(){
	categorythid=$("#categorythid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categorythid",
           data: {"categorythid" : categorythid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categoryfoid").empty(); 
               $("#categoryfoid").append("<option value=''>请选择四级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categoryfoid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });

</script> 
<form id="addForm" action="${BASE_PATH}/bus/goods/base/doAdd" method="post" enctype="multipart/form-data" class="form-horizontal" style="">
	
	<div class="form-group"  style="margin-left: 20px">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品基本信息</label>
		<span style="margin-left:10px; color:red;">(*)</span><span  style="margin-right:10px; ">标记的为必填项</span>
	</div>
	<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="names" id="names" class="form-control" placeholder="请输入宝贝名称" required maxlength="40"><span>此处文字不多于40字</span>
	    </div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品主图</label>
		<div class="col-sm-10">
			<input type="file" id="goodsthumb" name="goodsthumb"  style="width:30%;" accept="image/jpg,image/png" title="添加商品Logo图">
		</div>
	</div>
	<div class="form-group">
	<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>轮播图片</label>
		<div class="col-sm-10">
		 <input type='button' value='添加轮播图' onclick="toUploadImages();" style="background-color: #428bca;width: 89.81px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<c:if test="${userid==20 }">
	<div class="form-group">
	    <label class="col-lg-2 control-label">商品货号</label>
	    <div class="col-lg-9">
        	<input type="text" id="goodsNum" name="goodsNum" class="form-control" placeholder="请输入第三方商品货号">
	    </div>
	</div>
	</c:if>

	<%-- <div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类目</label>
	    <div class="col-lg-9">
    		<select id="categoryonid" name="categoryonid" class="selectpicker" data-width="24%" data-url="${BASE_PATH}/api/category" data-isfirst="true" data-next="#categorytwid" data-key="id:name"></select>
			<select id="categorytwid" name="categorytwid" class="selectpicker" data-width="24%" data-url="${BASE_PATH}/api/categorys/{value}"  data-key="id:name"></select>			
	    </div>
	</div> --%>
	<!-- =========================================================商品分类======================================================== -->
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类别</label>
	    <div class="col-sm-2">
        	<select name="categoryonid" id="categoryonid" class="form-control" required >
       			<option value="">一级分类</option>
       			<c:forEach items="${oneCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}">${category.categoryName}</option>	
				</c:forEach>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
        	<select name="categorytwid" id="categorytwid" class="form-control" required >
        		<option value=""   >二级分类</option>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categorythid" id="categorythid" class="form-control" required >
	        	<option value=""   >三级分类</option>
	        </select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categoryfoid" id="categoryfoid" class="form-control" required >
	        	<option value=""   >四级分类</option>
	        </select>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>市场售价</label>
	    <div class="col-lg-3">
        	<input type="text" name="sellPrice" id="sellPrice" class="form-control" onkeyup="(this.v3=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v3();" placeholder="请输入商品市场价" />
	    </div>
	</div>
		<!-- ================================================================================================================= -->
	<!-- 是否团购 -->
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>团购</label>
	    <div class="col-lg-9 group">
	        <label><input name="groupbuying" type="radio" value="1" checked />否</label>
			<label><input name="groupbuying" type="radio" value="2" />是</label>
			<div style="margin-right: 30px;" id="gbattr" >
				<label>团购价格<input type="text" name="gbprice" id="gbprice" size="12" placeholder="请输入数字" />元</label><br>
				<label>团购库存<input type="text" name="countnum" id="countnum" size="12" placeholder="请输入库存数量" /></label><br>
				<label>团购人数<input type="text" id="gbperson" name="gbperson" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入数字"  />人</label><br>
	   			<div class="col-lg-9 gmethod">
		   			<label>团购方式</label>
			   			<input name="gbmethod" type="radio" value="1" checked />普通
						<input name="gbmethod" type="radio" value="2" />免单
						<div id="gbfpperson" >
							<label>免单人数<input type="text" name="gbfreeperson" id="gbfreeperson" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入免单人数" />人</label><br>
							<label>付费人数<input type="text" name="gbpayperson" id="gbpayperson" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入付费人数" />人</label><br>		
			   			</div>
						<div style=" float: left;">
							<label class="search-label"></label><input type="text" id="beginDate" autocomplete="off" name="gbbegintime" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" >
							<label class="search-label">至</label><input type="text" id="endDate" autocomplete="off" name="gbendtime" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" />
						</div>
<!-- 				<label>拼团有效期<input type="text" id="gbLostTime" name="gbLostTime" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入数字" />小时</label><br>
 -->			</div>
			</div>
		</div>
	</div>
	<!-- 是否赠送优惠 -->
	<div class="form-group">
		<label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>赠送优惠</label>
		<div class="col-lg-9 zactivity" >
			<label><input name="zsactivity" type="radio" value="1" checked/>否   </label>
			<label><input name="zsactivity" type="radio" value="2" />是</label>
			<div style="margin-right: 30px;" id="zsnumattr">
				<label><input name="zspoint" type="checkbox" value="1" /> 积分值 
					<input type="text" name="zspointnum" id="zspointnum" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="zsdedu" type="checkbox" value="1" /> 抵扣券
					<input type="text" name="zsdedunum" id="zsdedunum" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="zscoupon" type="checkbox" value="1" /> 惠券
					<input type="text" name="zscouponnum" id="zscouponnum" size="12" placeholder="请输入数字" /></label>
			</div>
		</div>
	</div>
	<div class="form-group">
		<label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>适用分公司</label>
		<div class="col-lg-9">
			<input type="button" value="增加分公司" onclick="addStore();" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> <span>已选分公司(<span id="chooseNum" >0</span>)</span>
			<input type='button' value='删除分公司' id='deleteTablea' style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
			<input type="text" id="storeid" name="storeid" hidden="hidden" value="0"/>
		</div>
   </div>
   <div class="form-group">
    	<label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablea" style="width: 100%" border="1">
     			<tr>
     				<th style=" width:5%;font-size: 14px;text-align: center;"><input type="checkbox" name="checks" hidden="hidden"/>选择</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">分公司名称</th>
     				<th style=" width:20%;font-size: 14px;text-align: center;">分公司地址</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">分公司电话</th>
     			</tr>
	     	</table>
	    </div>
	</div>
	
	<!-- ******************************************************************************** -->
<div style="display:none;">
	<div class="form-group" >
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品规格设置</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="specName" id="specName" class="form-control" placeholder="请输入商品规格名称"  maxlength="20"><span>此处文字不多于20字</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格商品数量</label>
	    <div class="col-lg-9">
        	<input type="text" name="specNum" id="specNum" class="form-control" placeholder="请输入商品规格数量" onkeyup="(this.v123=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v123();" maxlength="20" /><span>例：5包/提，请输入5</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>门市价</label>
	    <div class="col-lg-9">
        	<input type="text" name="marketPrice" id="marketPrice" class="form-control" onkeyup="(this.v3=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v3();" placeholder="请输入商品分公司价" />
	    </div>
	</div>
		<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>库存数量</label>
	    <div class="col-lg-9">
        	<input type="text" id="stock" name="stock" class="form-control" onkeyup="(this.v4=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v4();" placeholder="请输入商品库存" />
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>支付方式</label>
	    <div class="col-lg-9 mpay" >
	        <label>货币支付
	        	<input type="text" name="sellerprice" id="sellerprice" size="12"  onkeyup="(this.v0=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v0();" placeholder="元"/>
	        </label><br>
			<!-- <label><input name="multipay" type="radio" value="2" />优惠支付</label>
	        	<div style="margin-right: 30px;" id="payonlyactivity">
					<label><input name="onlypaypoint" type="checkbox" value="1" /> 积分值 
						<input type="text" name="oppoint" id="oppoint" size="12"  placeholder="请输入数字" /></label><br>
					<label><input name="onlypaydedu" type="checkbox" value="1" /> 抵扣券
						<input type="text" name="opdedu" id="opdedu" size="12"  placeholder="请输入数字" /></label><br>
					<label><input name="onlypaycoupon" type="checkbox" value="1" /> 优惠券
						<input type="text" name="opcoupon" id="opcoupon" size="12" placeholder="请输入数字" /></label><br>
				</div>
				<div class="clear"></div>
			<label><input name="multipay" type="radio" value="3" />组合支付</label>
        	<div style="margin-right: 30px;" id="paymoneyandactivity">
      			<label><input name="mpayprice" type="checkbox" value="1" />货币值
      				<input type="text" name="muchsellerprice" id="muchsellerprice" size="12" onkeyup="(this.v11=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v11();" placeholder="元" /></label><br>
				<label><input name="mpaypoint" type="checkbox" value="1" /> 积分值 
					<input type="text" name="mppoint" id="mppoint" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="mpaydedu" type="checkbox" value="1" /> 抵扣券
					<input type="text" name="mpdedu" id="mpdedu" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="mpaycoupon" type="checkbox" value="1" /> 优惠券
					<input type="text" name="mpcoupon" id="mpcoupon" size="12" placeholder="请输入数字" /></label><br>
			</div> -->
	    </div>
	</div>

		<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>保存删除规格</label>
	    <div class="col-lg-9">
    		<input type="button" value="添加规格" onclick="addSpec();" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> <span>已加规格(<span id="chooseSpecNum" >0</span>)</span>
    		<input type='button' value='删除规格' id='delTablea'  onclick="deltTablElement();" style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
    		<input type="text" id="specid" name="specid" hidden="hidden" value="0"/>
	    </div>
	</div>
	<div class="form-group">
    	<label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablespec" style="width: 100%" border="1">
     			<tr>
     				<th style=" width:5%;font-size: 14px;text-align: center;"><input type="checkbox" name="specChecks" hidden="hidden"/>选择</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格名称</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格数量</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">门市价/元</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">库存数量</th>	
     				<th style=" width:15%;font-size: 14px;text-align: center;">货币</th>
     				<!-- <th style=" width:15%;font-size: 14px;text-align: center;">优惠类型</th>
     				<th style=" width:20%;font-size: 14px;text-align: center;">货币/优惠类型</th>  -->
     			</tr>
	     	</table>
	    </div>
	</div>
</div>
	<!-- 宝贝内容******************************************************************************** -->
	<div style="display:none;">
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品内容信息</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class=" col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>套餐内容 </label>
	    	<div class="col-lg-9">
	        	<input type="button" value="增加内容" id="addTable" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/>
	        	<input type='button' value='删除内容' id='deleteTable' style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
        	</div>
    </div>
	    <div class="col-lg-9" style="margin-left: 136px" >
       		<table id="tableb" style="width: 100%" border="1">
     			<tr>
					<th  class="thxuan"><input type="checkbox" name="check" hidden="hidden"/>选择</th>
     				<th class="thnei" >名称</th>
     				<th class="thnei" >数量</th>
     				<th class="thnei" >价值</th>
     			</tr>
     		</table>
	    </div>
	<div class="form-group"  style="margin-top: 50px">
	  <label class="col-lg-2 control-label">添加可选服务:</label>
	       <div class="col-lg-9" style="margin-top: 20px" id="keke" >
	        <textarea rows="5" cols="80" name="kemark" id="" placeholder="最多输入200字"  maxlength="200" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)"></textarea>
	      </div>
        	
    </div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>售卖时间:</label>
	    <div style="margin-left: 30px;">
	    	<label class="search-label"></label><input type="text" id="sBeginDate" autocomplete="off"  name="sBeginDate" class="width120 datetimepicker" data-format="yyyy-mm-dd"  required>
			至<input type="text" id="sEndDate" autocomplete="off"  name="sEndDate" class="width120 datetimepicker" data-format="yyyy-mm-dd"  required>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">兑换有效期</label>
	    <div class="col-lg-9 tuan">	
	    	<label><input name="goods" type="radio" value="1" checked/>实物商品   （下单付款后，7个工作日到店兑换有效，如果过期未兑换，购买款项将自动返还给客户）</label>
	    	<label><input name="goods" type="radio" value="2" />服务类商品 </label>
			<div style="margin-left: 30px;" id="tbts">
				<label><input name="times" type="radio" value="1" />兑换有效期与售卖时间相同</label><br>
				<label><input name="times" type="radio" value="2" />兑换有效期与售卖时间不同 </label>
				<div style=" float: right;" id="tbtd">
					<label class="search-label"></label><input type="text" id="beginDate" autocomplete="off" name="beginDate" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" >
					<label class="search-label">至</label><input type="text" id="endDate" autocomplete="off" name="endDate" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" />
		   		</div>
	   		</div>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">可用时间</label>
	    <div class="col-lg-9 kysj" >
	    	<label><input name="keyong" type="radio" value="1" checked/>不限时间 </label><br>
			<label><input name="keyong" type="radio" value="2" />部分时间可用  </label>
			<div style="float: right;" id="bufen">
				<select id="starttime" name="starttime"><option value="1">周一</option><option value="2">周二</option><option value="3">周三</option><option value="4">周四</option><option value="5">周五</option><option value="6">周六</option><option value="7">周日</option></select>
				    至 <select id="endtime" name="endtime"><option value="1">周一</option><option value="2">周二</option><option value="3">周三</option><option value="4">周四</option><option value="5">周五</option><option value="6">周六</option><option value="7">周日</option></select>
			</div>
	    </div>
	</div>
	<div class="form-group">
		    <label class="col-lg-2 control-label">限购</label>
		    <div class="col-lg-9 gmsx">
		        <label><input name="goumai" type="radio" value="1" checked/>无限制</label><br>
				<label><input name="goumai" type="radio" value="2" />限制每人购买<span id="zdsx"><input type="text" id="zdsx" name="zdsx" size="10" required placeholder="" value="1" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"/>次</span></label>
		    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">是否需要预约</label>
	    <div class="col-lg-9 xyyy">
	        <label><input name="yuyue" type="radio" value="1" checked/>否</label><br>
			<label><input name="yuyue" type="radio" value="2" />是  <span id="yyts">请您提前<input type="text" id="yyts" name="yyts" size="10"  placeholder="" /> 天预约</span></label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">适用人数</label>
	    <div class="col-lg-9 syrs">
	        <label><input name="shiyongrenshu" type="radio" value="0" checked/>不显示</label><br>
	        <label><input name="shiyongrenshu" type="radio" value="1" />不限人数</label><br>
			<label><input name="shiyongrenshu" type="radio" value="2" />建议人数<span id="jyrs"><input type="text" id="jyrss" required name="jyrs" size="10" placeholder=""onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" /> 人</span></label><br>
			<label><input name="shiyongrenshu" type="radio" value="3" />限制人数 <span id="xzrs">每张券最多<input type="text" required id="xzrss" name="zdrs" size="10" placeholder="" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"/> 人使用</span></label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">性别限定</label>
	    <div class="col-lg-9">
	    	<label><input name="xingbiexianding" type="radio" value="0" checked/>不显示</label><br>
	        <label><input name="xingbiexianding" type="radio" value="1"/>男女通用</label><br>
			<label><input name="xingbiexianding" type="radio" value="2" />仅限女宾</label><br>
			<label><input name="xingbiexianding" type="radio" value="3" />仅限男宾</label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">适用规则</label>
	    <div class="col-lg-9">
	        <label><input name="shiyongguize" type="radio" value="1" checked/>不再与其他优惠同享</label><br>
			<label><input name="shiyongguize" type="radio" value="2" />可与其他优惠同享</label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">补充内容</label>
	    <div class="col-lg-9">
	        <textarea rows="5" cols="80" name="bucong" id="bucong" placeholder="最多输入200字"  maxlength="200" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)"></textarea>
	    </div>
	</div>
</div>
	<!-- **************************************************************** -->
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品详情</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;"/>
	<div class="form-group">
	    <label class="col-lg-2 control-label">商品简介</label>
	    <div class="col-lg-9">
	        <textarea rows="5" cols="90" name="shortinfo" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" id="shortinfo"></textarea>
	    </div>
	</div>
	<!-- <div class="form-group">
		<label class="col-lg-2 control-label"><span class="must-fill">*</span>商品内容：</label>
		<div class="col-lg-8">
			 <textarea name="content" class="form-control" rows="60" placeholder="" required></textarea>
		</div>
	</div> -->
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>详情图片</label>
		<div class="col-sm-10">
		 <input type='button' value='添加详情图片' onclick="toXiang();" style="background-color: #337ab7;width: 100px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">备注</label>
		<div class="col-sm-10">
	        <textarea rows="5" cols="90" name="beizhu" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" ></textarea>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>客服二维码</label>
		<div class="col-sm-10">
			<input type="file" id="Qrthumb" name="Qrthumb"  style="width:30%;" accept="image/jpg,image/png" title="添加客服二维码">
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off" >提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left"  type="button" onclick="javascript:addDialog.close();" autocomplete="off">取消</button></div>
	</div>
	<input type="hidden" name="LunBoNum"  value="${LunBoNum}"/>
	<input type="hidden" name="IntLun" id="IntLun" value="0"/>
	<input type="hidden" name="Intditl" id="Intditl"  value="0"/>
</form>


